package com.xxx.study.designmodel.f中介者模式;

import java.util.Observable;

public class CPUObservable extends Observable implements Type{

    private String soundData;

    private String videoData;

    public String getSoundData() {
        return soundData;
    }

    public String getVideoData() {
        return videoData;
    }

    /**
     * cpu 作为被观察者，处理数据之后，通知观察者做出对应处理
     * @param data
     */
    public void dealData(String data) {
        // 处理数据
        String[] split = data.split(",");
        this.soundData = split[0];
        this.videoData = split[1];

        // 通知观察者做出对应处理
        this.setChanged();
        this.notifyObservers();
    }

    @Override
    public String getType() {
        return "CPUApi";
    }
}
